package com.ruoyi.web;

import net.sourceforge.tess4j.ITesseract;
import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;
import org.apache.commons.imaging.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

@RestController
@RequestMapping("/test/ocr")
public class Test4 {

    public static void main(String[] args) throws IOException, ImageReadException, ImageWriteException {
        File inputFile = new File("D:\\workspace\\idea\\new_back\\hahaha.jpg");
        File outputFile = new File("D:\\workspace\\idea\\new_back\\hahaha.png");
        BufferedImage image = Imaging.getBufferedImage(inputFile);
        Imaging.writeImage(image, outputFile, ImageFormats.PNG);
        System.out.println("aaaaaaaaaa");
    }
}
